# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-dateparser
pkgname=('python2-dateparser' 'python-dateparser')
_pkgname=dateparser
pkgver=1.2.2
pkgrel=1
pkgdesc='Date parsing library designed to parse dates from HTML pages.'
url='https://pypi.org/project/dateparser/#files'
arch=('any')
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('96ebc214843f57f3cdede79f63fd3067e9b26e17882a0dea023830e7a2a3f50b07145ae34d174bd3cd11f4f42980110111f90e7175fd38a4b0c428ac5f26428d')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-dateparser() {
  depends=('python2' 'python2-pytz' 'python2-tzlocal' 'python2-dateutil'
           'python2-regex')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-dateparser() {
  depends=('python' 'python-pytz' 'python-tzlocal' 'python-dateutil'
           'python-regex')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

